home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
151-175
/
scopedisk159
/
spreadsheet
/
spread.doc
< prev
next >
Wrap
Text File
|
1995-03-19
|
15KB
|
345 lines
*****************************************************************************
SPREAD - Tiny Amiga spreadsheet
Spread history (as if you care):
This program grew from a notion I had, 4 years ago, that a
spreadsheet would be a good tool to have, to help with certain jobs at
the office. I had read about VisiCalc, and later Lotus 1-2-3, but I had
never used a spreadsheet, so I designed Spread with few pre-conceived
notions about how it should work. As far as I know, Spread bears little
resemblance to any other spreadsheet.
The first version of Spread was written to run on a PDP-11
running RT11 or TSX, with a VT220 terminal. It was written in Decus C,
it only supported fixed-12-character columns, and only what the screen
could display. It was later enhanced to support a larger worksheet with
scrolling, and to support a 132 column display. Spread is still used at
the office almost use daily.
When I found myself dialing in to work from my Amiga to use
Spread fairly often (a long distance phone call too), I decided it was
time to port the program over to the Amiga.
The PDP-11 Spread used VT220 display controls and accepted VT220
function keys. These are not completely compatible with the features of
the Amiga CON: device, so I decided to re-write the user interface to
make best use of the Intuition's input and output features.
I started work on the Amiga version in early January 1988, and
spent most evenings and weekends at the keyboard (my wife hated it). You
have the result before you.
Amiga Spread supports a few features the PDP11 version doesn't,
specifically the ability of a text cell to overlay empty cells to the
right, the ability to set the column width and decimals, it supports a
larger worksheet (The PDP version must run in only 56K!), and of course
the Intuition interface.
Spread features:
o Small 36 X 60 worksheet
o Four basic math functions, plus row and column summing
o Intuition-ized user interface
o Resizable Workbench window
o Absolute and symbolic cell references in formulas
o Worksheet editing: insert/delete row, insert/delete column
o Cell editing: cut, copy, paste, erase single cells
o Variable column width and decimal places
o Automatic or Manual recalculation
Running Spread:
Spread can be invoked from the CLI or launched from a Workbench
icon. If launched from the Workbench, the Lattice C startup code will
first open a standard input/output window, which Spread ignores. It is
recommended that Spread be given a stack size of 8000. A larger stack
size provides no benefit.
If Spread is run from the CLI, you can include a command
parameter specifying the name of a file which Spread will load as the
current spreadsheet.
The Spread window gives a display of (r) rows and (n) columns.
The number of rows and columns depends on the current size of the
display window, the width of the individual columns, and the narrow/wide
font selection. The intersection of each line and column is called a
cell. Cells may be empty, or they may contain text, or they may contain
a formula.
Spread currently supports 60 rows and 36 columns. This is very
small by commercial product standards.
In the window, one cell is displayed in reverse; this indicates
the 'cursor'. The cursor may be moved using the arrow keys, or by
pointing to a cell with the mouse pointer and clicking.
If a movement would place the cursor on a cell which is not in
the display window, the display is scrolled. The horizontal and vertical
scroll bars also move the display window and the cursor.
If a cell contains text, then the text is displayed in the
window in that cell. If the text is wider than the current column's
width, then the text will 'overflow' into empty cells to the right of
the selected cell. If the text is so long that it would overflow into a
cell that is occupied, then the text is truncated at that point.
If a cell contains a formula, then the result of the formula is
displayed in the cell in the window. Calculations are double precision
floating point. The number display is initially 2 decimal places.
The contents of a formula cell is a string in simple algebraic
notation. It is evaluated according to the following rules:
Multiplication ('*'), division ('/'), and modulo ('%') are performed
first, from left to right; then addition ('+') and subtraction ('-')
from left to right; then MAX and MIN left to right; then conditionals
from left to right. The order of evauation can be forced by the use of
parentheses.
If you want a cell to simply contain a number, then make it a
formula cell, and type in the number you want as the formula.
Formula cells may be given logical names. The names can be
referred to in other cells' formulas to call the value from the cell;
this allows cell position changes within the display without affecting
the logical sources for values in formulas. Only formula cells may be
given names. The name must begin with a letter, and may contain
letters and numbers. It may not contain spaces.
Cell editing (text, formula, or name) is done in the string
gadgets at the bottom of the window.
When the cursor is on an empty cell, the entry gadgets at the
bottom of the window are ghosted and cannot be selected. The "Cells"
menu allows the choice of either a text cell or a formula cell. If
"Cells/Edit Text cell" or "Cells/Edit Formula Cell" is chosen, then the
cell type is chosen, the text gadget is enabled and activated, and the
text may be entered immediately.
When the cursor is on a text cell, the cell's text is placed in
the text gadget. This gadget can be selected and the text modified.
When the cursor is on a formula cell, the cell's formula and
name are placed in the text and name gadgets. These can be selected and
modified.
If you wish to change a text cell to a forumla cell or vice
versa, you must erase the current cell and define it anew. The menu
entries "Edit/Cut" or "Edit/Erase" will erase the contents of a cell.
Calculation can be set to automatic or manual. In automatic
mode, whenever a formula cell is edited or any change which may effect
the numeric results of other cells is performed, recalculation takes
place. In manual mode, recalculation is done when the "Calculate/
Evaluate" menu entry is selected, when the user presses the 'C' key, and
upon loading a new spreadsheet from disk, and no other time.
Calculation is done as follows: Each formula in the spreadsheet
is solved, starting in cell R0C0 and moving down, then repeating for
successive columns moving right. Cells which depend on other cells'
values should be placed under or to the right of the cells which supply
the values.
If a cell must make a 'forward' reference, to a cell which will
be calculated later in the spreadsheet, then calculating twice will
usually result in the correct value.
If a calculation can't be performed, the cell will display asterisks
('****.**') instead of a number. You should inspect your formula to see
what is wrong. You may have left your parentheses unbalanced, or perhaps
you refer to a cell name that you haven't defined.
Formulas
Formulas are algebraic expressions similar to FORTRAN or BASIC
expressions. Operations proceed left to right, according heirarchy
(multiplication after addition, etc). Expressions may be grouped with
parentheses.
Values are included in an expression using the following
notations:
<value> - a number, like '10', '-5', '2.34'
RmCn - takes the value in the cell at row (m) column (n)
Special case, either (m) or (n) can be '.', which
means to use the current row/column
name - takes the value in the cell with the given name.
The following arithmetic operators are provided:
+ Addition p + q
- Subtraction p - q
* Multiplication p * q
/ Division p / q
% Modulo (remainder from division) p % q
MAX greater of two values p MAX q
MIN lesser of two values p MIN q
- Negate -p
ABS Absolute value ABS(p), ABS p
INT Extract integer portion INT(p), INT p
SUM Sum of all cells in a row or column above/to the left of
the current cell. SUM's format:
SUM(RmCn)
'm' and 'n' can be:
a row/column number
'.' to specify the current row/column
'*' to specify all the rows/columns above/to
the left
Any of the above formats for 'row' and 'col' can be
combined except R*C*, which is invalid.
Conditional Binary operators; these are entered as binary
operators (one operand on each side) and give the second operand if the
conditional test on the first operand is true, otherwise they give zero:
?EQ op = 0 7 ?EQ 3 = 0 0 ?EQ 3 = 3
?NE op not = 0 7 ?NE 3 = 3 0 ?NE 3 = 0
?GT op greater than 0 7 ?GT 3 = 3 -7 ?GT 3 = 0
?GE op greater or equal 0 7 ?GE 3 = 3 -7 ?GE 3 = 0
?LT op less than 0 7 ?LT 3 = 0 -7 ?LT 3 = 3
?LE op less or equal 0 7 ?LE 3 = 0 -7 ?LE 3 = 3
Spread menu selections:
"Project" Menu
"Project/New": Erases the entire contents of the current
spreadsheet.
"Project/Load": Erases the entire contents of the current
spreadsheet, then loads a previously-saved spreadsheet. This brings up a
requester asking for the name of the file to load.
"Project/Save": Saves the current spreadsheet into a file.
Project/Save uses the same file name as the spreadsheet that was loaded,
or if no file name has been specified, it puts up a requester asking for
the name of the file to save to.
"Project/Save as..": saves the current spreadsheet into a file.
This puts up a requester asking for the name of the file to save to.
"Project/Print": prints to a file a displayable image of the
current spreadsheet. This puts up a requester asking for the name of the
file to print to, which can be "PRT:" to print directly to the printer.
(Note: background printing is not implemented, meaning that Spread will
stall until the spreadsheet had been printed entirely.)
"Project/About Spread": Try it and see.
"Project/Quit": Leaves Spread. If a spreadsheet is loaded it
will be lost; make sure you save it first if you want to keep it. The
close window button in the upper left corner performs the same function.
"Edit" Menu
"Edit/Cut": The current cell is saved in the paste buffer, and
becomes empty. (The 'current' cell is the cell the cursor is positioned
on, which is displayed in reverse.)
"Edit/Copy": The current cell is saved in the paste buffer. The
current cell is not altered.
"Edit/Paste": If the current cell is empty, then the contents of
the paste buffer is placed in the current cell.
"Edit/Erase": The current cell is made empty. It is not saved in
the paste buffer, and the paste buffer is not disturbed.
"Edit/Insert Row": The contents of all cells below and to the
right of the current cell, including the current cell, are shifted one
row down. The current cell and all the cells in the current row to the
right are made empty.
"Edit/Insert Col": The contents of all cells below and to the
right of the current cell, including the current cell, are shifted one
row to the left. The current cell and all cells below the current cell
are made empty.
"Edit/Delete Row": The contents of all cells below and to the
right of the current cell are shifted one row up. The contents of the
current cell, and of all cells in the current row to the right, are
lost.
"Edit/Delete Col": The contents of all cells below and to the
right of the current cell are shifted one row to the left. The contents
of the current cell, and of all cells in the current column below, are
lost.
Warning: If any cells use RmCn notation with actual cell numbers
in a formula, and the target cell is moved by any insert or delete
operation, then it's likely the formula is now incorrect. The cell name
feature should be used when making references to cells in formulas, as
name references are resolved regardless of cell locations.
"Cells" Menu
"Cells/Edit Cell Text": If the current cell is empty, it is made
a text cell. The Text gadget at the bottom of the window is activated,
as if you had clicked on it. Pressing the 'E' key has the same effect as
"Cells/Edit Cell Text", or if the text gadget is not ghosted you may
simply click on it to edit.
"Cells/Edit Cell Formula": If the current cell is empty, it is
made a formula cell. The Text gadget at the bottom of the window is
activated, as if you had clicked on it. Pressing the 'F' key has the
same effect as "Cells/Edit Cell Formula", or if the text gadget is not
ghosted you may simply click on it to edit.
"Cells/Edit Cell Name": The Name gadget at the bottom of the
window is activated, as if you had clicked on it. Pressing the 'N' key
has the same effect as "Cells/Edit Cell Name", or if the name gadget is
not ghosted you may simply click on it to edit.
"Calculate" Menu
"Calculate/Evaluate": The formulas in the current spreadsheet
are solved, and the results of the calculations are displayed in the
formula cells. This is the way to cause calculation if Auto Calc is
disabled, or if a calculation makes a forward referece to a cell (see
'order of calculation' above).
"Calculate/Auto Calc": When this entry is checked, the 'auto
calc' feature is enabled. Selecting this entry toggles it's state
between enabled (checked) and disabled (not checked).
"Format" Menu
"Format/Set Column Width": This entry brings up a requester
which allows you to enter the width of the current column, by the number
of characters it should hold.
"Format/Set Decimal Places": This entry brings up a requester
which allows you to enter the number of digits to the right of the
decimal point should be printed for formula cells in the current column.
"Format/Set Normal Font": Selecting this entry causes Spread to
use Topaz/8 for cell display.
"Format/Set Narrow Font": Selecting this entry causes Spread to
use the teeny/8 font for cell display. The teeny/8 font distributed with
Spread uses 5 pixel wide character spacing, which can display up to 128
characters on the 640-pixel Workbench screen, although the border
imagery around the Spread window allows only about 120 characters. If
the 'teeny/8' font is not in your current fonts: directory, this menu
selection will be ghosted.
If you generate your own font and call it teeny/8, or copy
another existing font to teeny/8, then Spread will use it with it's
metrics. It should be an 8 pixel high font, but could be a wider or
narrower font, fixed spacing or proportional. Spread will adjust
accordingly.
************************************************************************